package vrp;

import java.util.Date;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

//import java.util.Date;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Product {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private Key partner;

    @Persistent
    private String name;

    @Persistent
    private double price;

    @Persistent
    private double weight;

    @Persistent
    private int inventory;

    @Persistent
    private int status;

    @Persistent
    private Date createdAt;

    @Persistent
    private Date modifiedAt;

    public Product(Key partner, String name, double price, double weight, int inventory) {
    	this.partner = partner;
    	this.name = name;
        this.price = price;
        this.weight = weight;
        this.inventory = inventory;
    	this.status = 0; //0 for ok, non-0 for problem
    	this.createdAt = new Date();
    	this.modifiedAt = new Date();
    }

    public Key getKey() {
        return this.key;
    }

    public Key getPartner() {
        return this.partner;
    }

    public String getName() {
        return this.name;
    }

    public double getPrice() {
        return this.price;
    }

    public double getWeight() {
        return this.weight;
    }

    public int getInventory() {
        return this.inventory;
    }
    
    public int getStatus() {
        return this.status;
    }

    public Date getCreatedAt() {
        return this.createdAt;
    }

    public Date getModifiedAt() {
        return this.modifiedAt;
    }

    public void setKey(Key someKey) {
    	this.key = someKey;
    }
    
    public void setPartner(Key partner) {
    	this.partner = partner;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public void setInventory(int inventory) {
        this.inventory = inventory;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt= createdAt;
    }

    public void setModifiedAt(Date modifiedAt) {
        this.modifiedAt= modifiedAt;
    }
}